<div class="layui-card layadmin-header">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <a lay-href="">主页</a>
        <a><cite lay-href="/code/order/list">订单列表</cite></a>
        <a><cite>订单详情</cite></a>
    </div>
</div>
<style>
    .layui-form-label {
        width:15% !important;
        margin-left:1%;
    }
    .layui-input-inline {
        width: 33% !important;
    }
</style>
<div class="layui-fluid">
  <div class="layui-card">
    <div class="layui-tab layui-tab-brief">
        <div class="layui-tab-content">
            <form class="layui-form layui-form-pane" action="">
                <div class="layui-form-item">
                    <label class="layui-form-label">收款人</label>
                    <div class="layui-input-inline">
                        <input type="text" id="codeName" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">二维码类型</label>
                    <div class="layui-input-inline">
                        <select name="codeType" id="codeType" disabled="disabled" lay-search="">
                            <option value="1">支付宝</option>
                            <option value="2">微信</option>
                            <option value="3">聚合码</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">订单号</label>
                    <div class="layui-input-inline">
                        <input type="text" id="orderNo" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">商户订单号</label>
                    <div class="layui-input-inline">
                        <input type="text" id="mchOrderNo" disabled="disabled" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">订单金额</label>
                    <div class="layui-input-inline">
                        <input type="text" id="amount" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">调整前金额</label>
                    <div class="layui-input-inline">
                        <input type="text" id="oldAmount" disabled="disabled" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">状态</label>
                    <div class="layui-input-inline">
                        <select name="status" id="status" disabled="disabled" lay-search="">
                            <option value="3">业务完成</option>
                            <option value="2">支付成功</option>
                            <option value="1">支付中</option>
                            <option value="0">订单生成</option>
                            <option value="-1">支付失败</option>
                            <option value="-2">订单过期</option>
                        </select>
                    </div>
                    <label class="layui-form-label">费率</label>
                    <div class="layui-input-inline">
                        <input type="text" id="userRate" disabled="disabled" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">创建时间</label>
                    <div class="layui-input-inline">
                        <input type="text" id="createTime" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">确认时间</label>
                    <div class="layui-input-inline">
                        <input type="text" id="confirmTime" disabled="disabled" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">客户端IP</label>
                    <div class="layui-input-inline">
                        <input type="text" id="clientIp" disabled="disabled" class="layui-input">
                    </div>
                    <label class="layui-form-label">操作阶段</label>
                    <div class="layui-input-inline">
                        <select name="status" id="status" disabled="disabled" lay-search="">
                            <option value="0">生成订单</option>
                            <option value="1">打开订单页</option>
                            <option value="2">扫码</option>
                            <option value="3">点击支付跳转按钮</option>
                            <option value="4">进入app支付</option>
                            <option value="5">转账</option>
                        </select>
                    </div>
                </div>
            </form>
        </div>
    </div>
  </div>
</div>

<script>
    layui.use(['admin','form'],function(){
        var form = layui.form
        ,$ = layui.$
        ,admin = layui.admin
        ,element = layui.element
        ,layer = layui.layer ;
        // 导航
        element.render('breadcrumb', 'breadcrumb');
        console.log(layui.router());
        var id = layui.router().search.id;
        admin.req({
            type: 'get',
            url: layui.setter.baseUrl + '/code/order/get',
            data: {
                id : id
            },
            error: function(err){
                layer.alert(JSON.stringify(err.field), {
                    title: '错误提示'
                })
            },
            success: function(res){
                if(res.code == 0){
                    $('#codeName').val(res.data.codeType);
                    $('#codeType').val(res.data.codeType);
                    $('#amount').val(res.data.amount);
                    $('#oldAmount').val(res.data.oldAmount);
                    $('#orderNo').val(res.data.orderNo);
                    $('#mchOrderNo').val(res.data.mchOrderNo);
                    $('#status').val(res.data.status);
                    $('#userRate').val(((res.data.userRate+res.data.agentRate+res.data.codeBusRate)*100).toFixed(2)+'%');
                    $('#createTime').val(res.data.createTime);
                    $('#confirmTime').val(res.data.confirmTime);
                    $('#clientIp').val(res.data.clientIp);
                    $('#operatePhase').val(res.data.operatePhase);
                    form.render();
                }
            }
        })
    })
</script>